import { base } from '@/config'
import http from '@/utils/request'

const orderApi = {
  // 获取列表
  getOrderList: params => {
    return http.get(`${base.order}/orderManager/page`, params)
  },
  // 获取详情
  getOrderDetail: orderNo => {
    return http.get(`${base.order}/orderManager/detail/${orderNo}`)
  },
  // 取消订单
  cancelOrder: params => {
    return http.postJson(`${base.order}/orderManager/cancel`, params)
  },
  // 审核订单地址修改
  auditUpdateAddressApply: params => {
    return http.postJson(`${base.order}/orderManager/auditUpdateAddressApply`, params)
  },

  // 订单邮件导出
  exportEmail: params => {
    return http.get(`${base.order}/orderManager/exportEmail`, params)
  },
  // 订单统计
  getOrderTotal: params => {
    return http.get(`${base.order}/orderManager/page/count`, params)
  },
  // 发货列表
  getBranchList: params => {
    return http.get(`${base.order}/orderExpress/query/batch`, params)
  },
  // 订单发货
  deliverOrderShip: params => {
    return http.postJson(`${base.order}/orderExpress/deliver`, params)
  },
  // 修改物流
  updateExpress: params => {
    return http.postJson(`${base.order}/orderExpress/update`, params)
  },
  // 批量发货
  batchShip: params => {
    return http.postJson(`${base.order}/orderExpress/deliver/batch`, params)
  },
  // 查看物流
  getExpressInfo: expressId => {
    return http.get(`${base.order}/orderExpress/query/${expressId}`)
  },
  // 获取新人购买记录
  getNewcomerOrderList: params => {
    return http.get(`${base.order}/orderManager/newPeople/page`, { params })
  },
  // 查看第三方物流
  getOtherExpressInfo: params => {
    return http.get(`${base.order}/orderExpress/query/thirdParty`, { params })
  }
}

export default orderApi
